#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include<stdbool.h>

typedef struct Heap
{
	int* arr;
	int size;
	int capacity;
}Heap;

void HeapInit(Heap* php);
void HeapDestroy(Heap* php);
bool HeapEmpty(Heap* php);
void HeapPrint(Heap* php);
int Heapsize(Heap* php);

void Swap(int* x, int* y);

void AdjustUp(int* arr, int child);
void AdjustDown(int* arr, int parent, int n);

void HeapPush(Heap* php, int x);
void HeapPop(Heap* php);

int HeapTop(Heap* php);

void HeapSort(int* arr, int n);